﻿Imports System.ComponentModel.DataAnnotations

Public Class PatientProblem
    Public Property problemID() As Short
    <Required()> _
    Public Overloads Property patientId() As Long
    <Required()> _
    Public Property reportedDateTime() As Date
    <Required()> _
    Public Property reportedDr() As Integer? = Nothing
    <Required()> _
    Public Property problem() As Integer
    Public Property period() As System.Nullable(Of Single)
    Public Property problemPeriod() As System.Nullable(Of Integer)
    Public Property problemTiming() As System.Nullable(Of Integer)
    Public Property problemDuration() As System.Nullable(Of Integer)
    Public Property problemLocation() As System.Nullable(Of Integer)
    Public Property severity() As System.Nullable(Of Integer)

    Public Property problemName() As String = String.Empty
    Public Property problemPeriodName() As String = String.Empty
    Public Property problemTimingName() As String = String.Empty
    Public Property problemDurationName() As String = String.Empty
    Public Property problemLocationName() As String = String.Empty
    Public Property severityName() As String = String.Empty

    Public Property comments() As String

#Region "NHibernate Composite Key Requirements"
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
        If obj Is Nothing Then Return False
        Dim t = TryCast(obj, PatientProblem)
        If t Is Nothing Then Return False
        If patientId = t.patientId AndAlso problemID = t.problemID Then
            Return True
        End If

        Return False
    End Function
    Public Overrides Function GetHashCode() As Integer
        Dim hash As Integer = 13
        hash += patientId.GetHashCode()
        hash += problemID.GetHashCode()

        Return hash
    End Function
#End Region
End Class
